﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.ParkManage;
using LJX.SmartPark.Service.ParkManage;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static LJX.SmartPark.Service.ParkManage.DeviceListServeice;

namespace LJX.SmartPark.WebApi.Controllers.ParkManage
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "ParkManage")]
    public class DeviceListController : ControllerBase
    {
        private readonly IDeviceListServeice _deviceListService;

        public DeviceListController(IDeviceListServeice deviceListService)
        {
            _deviceListService = deviceListService;
        }

        /// <summary>
        /// 获取总条数
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public int GetCount()
        {
            return _deviceListService.GetCount();
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<DeviceList>> GetDeviceListAsync(FyDeviceList fyDeviceList)
        {
            var result = _deviceListService.GetDeviceListAsync(fyDeviceList);
            return result.Result;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Response<DeviceList> GetDeviceListById(DeviceList input)
        {
            var result = _deviceListService.GetDeviceListById(input);
            return result;
        }
    }
}
